﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MainFrame.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    用户信箱
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Header" runat="server">
    <link href="<%=Url.Content("~/Content/css/admin.css") %>" rel="Stylesheet" type="text/css" />
    <link href="<%=Url.Content("~/Content/css/ui.jqgrid.css") %>" rel="Stylesheet" type="text/css" />
    <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery.layout.js") %>"></script>
    <script type="text/javascript" src="<%=Url.Content("~/Scripts/i18n/grid.locale-cn.js") %>"></script>
    <script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery.jqGrid.min.js") %>"></script>
    <style type="text/css">
        html, body
        {
            margin: 0; /* Remove body margin/padding */
            padding: 0;
            overflow: hidden; /* Remove scroll bars on browser window */
            font-size: 75%;
        }
        /*Splitter style */
        
        
        #LeftPanel
        {
            /* optional, initial splitbar position */
            overflow: auto;
        }
        /*
 * Right-side element of the splitter.
*/
        
        #RightPanel
        {
            padding: 2px;
            overflow: auto;
        }
        .ui-tabs-nav li
        {
            position: relative;
        }
        .ui-tabs-selected a span
        {
            padding-right: 10px;
        }
        .ui-tabs-close
        {
            display: none;
            position: absolute;
            top: 3px;
            right: 0px;
            z-index: 800;
            width: 16px;
            height: 14px;
            font-size: 10px;
            font-style: normal;
            cursor: pointer;
        }
        .ui-tabs-selected .ui-tabs-close
        {
            display: block;
        }
        .ui-layout-west .ui-jqgrid tr.jqgrow td
        {
            border-bottom: 0px none;
        }
        .ui-datepicker
        {
            z-index: 1200;
        }
        .link:hover
        {
            cursor: pointer;
            margin: 3px;
        }
    </style>
    <script type="text/javascript">
        function LoadFunction(url) {
            $.ajax({
                url: url,
                beforeSend: function () {
                    $.blockUI();
                },
                success: function (data) {
                    $("#right").html(data);
                    InitDialogLink($("a.dialog"), $("#dlgPanel"));
                    $.unblockUI();
                }
            });
        }
        var tabID = null;
        var tabUrl = null;
        $(function () {
            $('body').layout({
                resizerClass: 'ui-state-default',
                west__onresize: function (pane, $Pane) {
                    jQuery("#west-grid").jqGrid('setGridWidth', $Pane.innerWidth() - 2);
                }
            });

            var maintab = $('#tabs', '#RightPanel').tabs({
                add: function (e, ui) {
                    // append close thingy
                    $(ui.tab).parents('li:first')
				.append('<span class="ui-tabs-close ui-icon ui-icon-close" title="Close Tab"></span>')
				.find('span.ui-tabs-close')
				.click(function () {
				    maintab.tabs('remove', $('li', maintab).index($(this).parents('li:first')[0]));
				});
                    // select just added tab
                    maintab.tabs('select', '#' + ui.panel.id);
                },
                select: function (e, ui) {
                    tabID = ui.panel.id;
                    tabUrl = $("#" + ui.panel.id.replace("t", "")).find("a").attr("href");
                }
            });
            var westGrid = $("#west-grid");

            tableToGrid(westGrid, { onSelectRow: function (rowid) {
                var div = $("#west-grid tbody tr:eq(" + rowid + ") td div");
                var st = "#t" + div.attr("id");
                var url = div.find("a").attr("href");
                var name = div.find("span").text();
                if ($(st).html() != null) {
                    maintab.tabs('select', st);
                    $(st, "#tabs").html("Just Loading!!!");
                    $(st, "#tabs").load(url, function () {
                        InitDialogLink($("a.dialog"), $("#dialogPanel"));
                    });
                } else {
                    maintab.tabs('add', st, name);
                    $(st, "#tabs").html("Just Loading!!!");
                    $(st, "#tabs").load(url, function () {
                        InitDialogLink($("a.dialog"), $("#dialogPanel"));
                    });
                }
            }
            });
            //}
            //});
        });
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div id="LeftPanel" class="ui-layout-west ui-widget ui-widget-content">
        <table id="west-grid">
            <tr>
                <th>
                    导航菜单
                </th>
            </tr>
            <tr>
                <td>
                    <div id="sendMsg">
                        <span class="link">发信件</span> <a style="display: none" href='<%:Url.Action("Send","Message") %>'>
                        </a>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div id="ReceiveMsgBox">
                        <span class="link">收件箱</span> <a style="display: none" href='<%:Url.Action("ReceiveMessages","Message") %>'>
                        </a>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div id="SendedMsgBox">
                        <span class="link">已发信件</span> <a style="display: none" href='<%:Url.Action("SendedMessages","Message") %>'>
                        </a>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <!-- #LeftPane -->
    <div id="RightPanel" class="ui-layout-center ui-helper-reset ui-widget-content">
        <!-- Tabs pane -->
        <div id="tabs" class="jqgtabs">
            <ul>
                <li><a href="#tabs-1">首页</a></li>
            </ul>
            <div id="tabs-1" style="font-size: 12px;">
                欢迎使用站内信息系统<br />
                您有<span id="MessageNotRead"><%:ViewData["NotRead"] %></span>条未读信息
            </div>
        </div>
    </div>
    <!-- #RightPane -->
</asp:Content>
